<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
    <script>
        var arr = new Array();
        arr[0] = new Array("东城区","西城区","宣武区","崇文区","朝阳区","丰台区","石景山区","海淀区","门头沟区","房山区","通州区","顺义区","昌平区","平谷区","大兴区","怀柔区");
        arr[1] = new Array("石家庄市","唐山市","邯郸","保定","沧州","邢台","廊坊","承德","张家口市","衡水市","秦皇岛市");
        arr[2] = new Array("东丽区","西青区","津南区","北辰区","武清区","宝坻区","蓟州区","静海区","和平区","河西区","河北区","河东区","南开区","红桥区","滨海新区","宁河区");
        arr[3] = new Array("太原市","大同市","阳泉市","长治市","晋城市","朔州市","忻州市","晋中市","临汾市","吕粱市","运城市");
        function f(val) {
            document.getElementById('city').innerHTML = "<option>未选择</option>";
            for (var i= 0;i<arr[val].length;i++){
                if (i==0) document.getElementById('city').innerHTML = "";
                document.getElementById('city').innerHTML += "<option>"+arr[val][i]+"</option>";
            }
        }
    </script>
<body>
    <select onchange="f(this.value)">
        <option value="">未选择</option>
        <option value="0">北京</option>
        <option value="1">河北</option>
        <option value="2">天津</option>
        <option value="3">山西</option>
    </select>
    <select id="city">
        <option>未选择</option>
    </select>
</body>
</html>